<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>退票申请添加</title>
    <%@include file="common/head.jsp" %>
    <%@include file="common/loginstate.jsp" %>
    <script type="text/javascript" src="${staticPath}/js/popup.js"></script>
    <script language="JavaScript" src="${staticPath}/js/public.js" type="text/javascript"></script>
    <link href="${staticPath}/qtimages/images/apple-touch-icon.png" rel="apple-touch-icon">
    <link href="${staticPath}/qtimages/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/animate/animate.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/ionicons/css/ionicons.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/magnific-popup/magnific-popup.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/ionicons/css/ionicons.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${staticPath}/qtimages/css/style.css" rel="stylesheet">
    <link rel="stylesheet" href="${staticPath}/qtimages/css/custom.css">

    <script type="text/javascript">
        //文件上传
        function upx(id) {
            var pop=new Popup({ contentType:1,isReloadOnClose:false,width:400,height:200});
            pop.setContent("contentUrl","${contextPath}/common/upload/?id="+id);
            pop.setContent("title","文件上传");
            pop.build();
            pop.show();
        }
        // 添加退票申请
        function tuipiaoshenqingAdd() {
			var xingming = $("#xingming").length > 0 ? $('#xingming').val().trim():null;
			if(("#xingming").length > 0 && xingming == "")
			{
				alert("please input:姓名");
			    $('#xingming').focus();
				return false;
			}
			var dianhua = $("#dianhua").length > 0 ? $('#dianhua').val().trim():null;
			if ($("#dianhua").length > 0) {
				if (dianhua == "") {
					alert("please input:电话");
					$('#dianhua').focus();
					return false;
				} else {
					if (/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(dianhua)) {
					} else {
						alert("必需手机格式");
						$('#dianhua').focus();
						return false;
					}
				}
			}
			var shenfenzhenghao = $("#shenfenzhenghao").length > 0 ? $('#shenfenzhenghao').val().trim():null;
			if ($("#shenfenzhenghao").length > 0) {
				if (shenfenzhenghao == "") {
					alert("please input:身份证号");
					$('#shenfenzhenghao').focus();
					return false;
				} else {
					// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
					if (/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(shenfenzhenghao)) {
					} else {
						alert("必需身份证格式");
						$('#shenfenzhenghao').focus();
						return false;
					}
				}
			}
			var banci = $("#banci").length > 0 ? $('#banci').val().trim():null;
			if(("#banci").length > 0 && banci == "")
			{
				alert("please input:班次");
			    $('#banci').focus();
				return false;
			}
			var beizhu = $("#beizhu").length > 0 ? $('#beizhu').val().trim():null;
			if(("#beizhu").length > 0 && beizhu == "")
			{
				alert("please input:备注说明");
			    $('#beizhu').focus();
				return false;
			}
			var shijian = $("#shijian").length > 0 ? $('#shijian').val().trim():null;
			if(("#shijian").length > 0 && shijian == "")
			{
				alert("please input:时间");
			    $('#shijian').focus();
				return false;
			}
			var shenhe=$('#shenhe').val().trim();
			var usersid=$('#usersid').val().trim();

            var param = {
				'xingming':xingming,
				'dianhua':dianhua,
				'shenfenzhenghao':shenfenzhenghao,
				'banci':banci,
				'beizhu':beizhu,
				'shijian':shijian,
				'shenhe':shenhe,
				'usersid':usersid,

            };
            $.ajax({
                type: 'post',
                url: '${basePath}/tuipiaoshenqingAddOrUpdate',
                dataType: "json",
                contentType:"application/json",
                data : JSON.stringify(param),
                success: function (resp) {
                    if (resp.success) {
                        alert("添加成功！");
                        //window.location.href = "${contextPath}/tuipiaoshenqingManaMyQian";
                    } else {
                        alert(resp.message);
                    }
                }
            });
        }
    </script>
</head>

<body>
<%@ include file="qttop.jsp" %>
<%@ include file="bht.jsp" %>
<main id="main">
    <section id="services" class="wow fadeInUp">
        <div class="container">
            <div class="section-header">
                <h2>◇◆ 退票申请添加 ◆◇</h2>
            </div>
            <div class="row">

                <form  name="formAdd" id="formAdd">
                    <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolor="#00FFFF"
                           style="border-collapse:collapse" class="newsline">
		<tr>
			<td>
				姓名:
			</td>
            <td>
                <input type="text" name="xingming" id="xingming" size="70px"/>
            </td>

		</tr>
		<tr>
			<td>
				电话:
			</td>
            <td>
                <input type="text" name="dianhua" id="dianhua" size="70px"/>
            </td>

		</tr>
		<tr>
			<td>
				身份证号:
			</td>
            <td>
                <input type="text" name="shenfenzhenghao" id="shenfenzhenghao" size="70px"/>
            </td>

		</tr>
		<tr>
			<td>
				班次:
			</td>
            <td>
                <input type="text" name="banci" id="banci" size="70px"/>
            </td>

		</tr>
		<tr>
			<td>
				备注说明:
			</td>
            <td>
                <input type="text" name="beizhu" id="beizhu" size="70px"/>
            </td>

		</tr>
		<tr>
			<td>
				时间:
			</td>
            <td>
                <input type="text" name="shijian" id="shijian" style="border:1px solid #cccccc;" readonly="readonly" size="25px" value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())%>" />
            </td>

		</tr>
		<tr style="display: none;">
			<td>
				是否审核:
			</td>
            <td style="display: none">
                <select name="shenhe" id="shenhe" style="border:solid 1px #000000; color:#666666">
                    <option value="no">no</option>
                    <%--<option value="yes">yes</option>--%>
                </select>
            </td>

		</tr>
		<tr style="display: none;">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				用户:
			</td>
            <td style="display: none">
                <select name="usersid" id="usersid" style="border:solid 1px #000000; color:#666666">
                    <option value="${sessionScope.user.id }">${sessionScope.user.loginname }</option>
                </select>
            </td>

		</tr>

                        <tr>
                            <td>&nbsp;</td>
                            <td>
                                <input type="button" name="Submit" value="提交" onClick="tuipiaoshenqingAdd();"
                                       class="content-form-signup"/>
                                <input type="button" value="返回" onClick="javascript:history.back()"/>
                                <%--<input type="reset" name="reset" value="重置" class="content-form-signup"/>--%>
                            </td>
                        </tr>
                    </table>
                </form>

            </div>
        </div>
    </section>
    <%@ include file="qtdown.jsp" %>
</main>
</body>
</html>

